[AutoTable] Allow sorting by CustomCellColumn#937
Closed
adamrneary wants to merge 2 commits intogadget-inc:mainfrom
Closed
[AutoTable] Allow sorting by CustomCellColumn#937adamrneary wants to merge 2 commits intogadget-inc:mainfrom
adamrneary wants to merge 2 commits intogadget-inc:mainfrom
Conversation
Added optional `field` and `sortable` properties to `CustomCellColumn` type, enabling custom rendered columns to be sortable when a field path is provided. The sortability is determined by the field's metadata, consistent with how regular columns work. Changes: - Updated CustomCellColumn type with optional field and sortable properties - Updated TableColumn union to allow field on CustomRenderer type - Modified getTableColumns to determine sortability based on field metadata - Updated Shadcn and Polaris table components to handle sortable custom columns - Added tests for sortable custom column behavior
…rs-01VKFAGNpQfTYu9mbBXQvy5d allow sorting columns with custom renderers by specifying a field
Contributor
MillanWangGadget
left a comment
There was a problem hiding this comment.
- 🟢 passing in a field API id properly makes it sortable by that field
- 🟡 Invalid input field API ids do not make the field sortable, but should throw an error so that you know immediately that you're trying to do something impossible
- 🟡 Unsortable fields like
Filetype fields can be passed in, but do nothing. Same as above with throwing an error when trying to do something impossible. - 🟡 Through-a-relationship fields like
someHasManyField.edges.node.someFieldOnOtherModelcan be passed in, and throw an error when you try to sort.- We don't currently support this in the API, and for now, I think it'd be better to throw an error on first render instead of on sort.
- 🟡 In
type:"CustomRenderer"columns, I think it'd be nice to rename the added property to be something likesortByFieldto be more clear that it's only gonna be used for sorting.
Contributor
|
Closing with implementation in here #961 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey folks! I am new to contributing to this project. Should I be bumping package versions as part of this PR? Or should I be leaving that to Gadget folks? Happy to follow your guidelines.
Also happy to take any feedback on the approach. I think this change is desireable, but let me know if you don't think this is the right direction.
For context, I originally raised the issue here: https://discord.com/channels/836317518595096598/1446926428221210644. Then realized I could fix up the issue myself.
PR Checklist